package com.gisocn.onemap.ui.popupwindow;

import android.content.Context;
import android.graphics.drawable.BitmapDrawable;
import android.view.View;
import android.widget.PopupWindow;
import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.gisocn.onemap.model.LandInfo;
import com.gisocn.onemap.sgzx.R;
import com.gisocn.onemap.ui.adapter.QueryLandInfoAdapter;
import java.util.ArrayList;

/* loaded from: classes2.dex */
public class LandInfoDetailPopWindow extends PopupWindow {
    private Context context;
    private ArrayList<LandInfo> dataList;
    private int height;
    private ArrayList<LandInfo> landInfoDataList = new ArrayList<>();
    private QueryLandInfoAdapter queryLandInfoAdapter;
    private int width;

    public LandInfoDetailPopWindow(Context context, ArrayList<LandInfo> arrayList, int i, int i2) {
        this.context = context;
        this.dataList = arrayList;
        this.width = i;
        this.height = i2;
        initView();
    }

    private void initView() {
        View inflate = View.inflate(this.context, R.layout.popup_query_land_info, null);
        setContentView(inflate);
        setWidth(this.width);
        setHeight(this.height);
        setFocusable(false);
        setOutsideTouchable(false);
        setBackgroundDrawable(new BitmapDrawable());
        TextView textView = (TextView) inflate.findViewById(R.id.tv_close);
        RecyclerView recyclerView = (RecyclerView) inflate.findViewById(R.id.recycle_land_info);
        if (this.queryLandInfoAdapter == null) {
            recyclerView.setLayoutManager(new LinearLayoutManager(this.context));
            QueryLandInfoAdapter queryLandInfoAdapter = new QueryLandInfoAdapter(R.layout.item_query_land_info, this.landInfoDataList);
            this.queryLandInfoAdapter = queryLandInfoAdapter;
            recyclerView.setAdapter(queryLandInfoAdapter);
        }
        if (this.landInfoDataList.size() > 0) {
            this.landInfoDataList.clear();
        }
        ArrayList<LandInfo> arrayList = this.dataList;
        if (arrayList != null && arrayList.size() > 0) {
            this.landInfoDataList.addAll(this.dataList);
        }
        textView.setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.popupwindow.LandInfoDetailPopWindow.1
            @Override // android.view.View.OnClickListener
            public void onClick(View view) {
                LandInfoDetailPopWindow.this.dismiss();
            }
        });
    }

    public void updateData(ArrayList<LandInfo> arrayList) {
        if (this.landInfoDataList.size() > 0) {
            this.landInfoDataList.clear();
        }
        if (arrayList.size() > 0) {
            this.landInfoDataList.addAll(arrayList);
        }
        this.queryLandInfoAdapter.notifyDataSetChanged();
    }
}
